<template>
    <div>
        <h2>{{ title }}</h2>
        {{ count }}&nbsp;<button @click="addCount">count++</button>
    </div>
</template>
<script setup>
import { ref } from 'vue';

// defineProps(['title'])
defineProps({
    title: {
        type: String,
        default: '我是默认值'
    },
})

let count = ref(0);
const addCount = () => {
    count.value++;
}
</script>

<!-- <script>
import { ref } from 'vue';

export default {
    props: ['title'],
    setup() {
        let count = ref(0);
        const addCount = () => {
            count.value++;
        }
        return {
            count, addCount
        }
    }
}
</script> -->
